<?php

use think\migration\Migrator;
use think\migration\db\Column;

class WarehouseLocationGoods extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('warehouse_location_goods', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '仓库库位商品表', 'signed' => false]);
        $table->addColumn('company_id', 'integer', ['default' => 0, 'limit' => 20, 'comment' => '公司id', 'signed' => false])
            ->addColumn('warehouse_id', 'integer', ['default' => 0, 'limit' => 20, 'comment' => '仓库id', 'signed' => false])
            ->addColumn('warehouse_location_id', 'integer', ['default' => 0, 'limit' => 20, 'comment' => '库位id', 'signed' => false])
            ->addColumn('dealer_id', 'integer', ['default' => 0, 'limit' => 20, 'comment' => '经销商id', 'signed' => false])
            ->addColumn('dealer_goods_id','integer', ['default' => 0, 'limit' => 20, 'comment' => '经销商商品id', 'signed' => false])
            ->addColumn('dealer_spec_id', 'integer', ['default' => 0, 'limit' => 20, 'comment' => '经销商规格id', 'signed' => false])
            ->addColumn('create_time', 'integer', ['default' => null, 'limit' => 10, 'comment' => '创建时间', 'signed' => false])
            ->addColumn('update_time', 'integer', ['default' => null, 'limit' => 10, 'comment' => '更新时间', 'signed' => false])
            ->addColumn('delete_time', 'integer', ['default' => null, 'limit' => 10, 'comment' => '删除时间', 'signed' => false])
            ->addIndex('dealer_id')
            ->addIndex('dealer_goods_id')
            ->addIndex('dealer_spec_id')
            ->addIndex('warehouse_id')
            ->addIndex('warehouse_location_id')
            ->create();
    }
}
